package atom.core0.log;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.apache.log4j.PropertyConfigurator;

import atom.core0.util.StringUtil;

public class Log4jInit
{
	//confFilePath = "./log4j.conf"
	//logFilePath = "./log"
	public static void init(String confFilePath,String logFilePath) 
	{
		System.setProperty("log4jpath", logFilePath);
		if (StringUtil.isEmpty(confFilePath))
		{
			return;
		}

		try
		{
			Properties ps = new Properties();
			FileInputStream fin=new FileInputStream(confFilePath); 
			ps.load(fin);
			PropertyConfigurator.configure(ps);
			
			//PropertyConfigurator.configureAndWatch(file,1000);// 间隔特定时间，检测文件是否修改，自动重新读取配置   
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}
